<?php
require_once 'PHPUnit/Framework.php';

require_once(dirname(__FILE__).'/../../../models/relation/UCModBlacklist.php');
require_once(dirname(__FILE__).'/../../../libraries/UCLibLogger.php');  
/**
@assert (...) == X    assertEquals(X, method(...))
@assert (...) != X    assertNotEquals(X, method(...))
@assert (...) === X    assertSame(X, method(...))
@assert (...) !== X    assertNotSame(X, method(...))
@assert (...) > X    assertGreaterThan(X, method(...))
@assert (...) >= X    assertGreaterThanOrEqual(X, method(...))
@assert (...) < X    assertLessThan(X, method(...))
@assert (...) <= X    assertLessThanOrEqual(X, method(...))
@assert (...) throws X    @expectedException X
*/
class UCModBlacklistTest extends PHPUnit_Framework_TestCase {
    private $_bmod;
    private $_gid;
    
    protected function setUp()
    {
        UCLibLogger::attach(new StdoutLogOb());
        $this->_bmod = new UCModBlacklist(110000308490);
        $ret= $this->_bmod->addPersonToBlacklist(5555);   
    }
    protected function tearDown()
    {
        $this->_bmod->deletePersonOutBlacklist(5555);   
    }
    
    /**
    * @dataProvider providerUserid
    * 
    */
    function test_addPersonToBlacklist($uid)
    {
        $ret = $this->_bmod->addPersonToBlacklist($uid);
        $this->assertTrue($ret, 'errno['.$this->_bmod->getLastErrno().'],error:'.$this->_bmod->getLastError());
        $this->_bmod->deletePersonOutBlacklist($uid);
    }
    
    function test_getMyBlacklist()
    {
        $ret = $this->_bmod->getMyBlacklist();               
        //$this->assertGreaterThan(0, $ret, 'error code:'.$this->_bmod->getLastErrno());
    }
    
    function test_getBlacklistCount()
    {
        $ret = $this->_bmod->getBlacklistCount();                   
        $this->assertGreaterThan(0, $ret, 'error code:'.$this->_bmod->getLastErrno());
    }
    
    function test_getJudgePerson()
    {
        $ret = $this->_bmod->getJudgePerson(5555);                     
        $this->assertEquals(1, $ret, 'error code:'.$this->_bmod->getLastErrno());
        $ret = $this->_bmod->getJudgePerson(5556);                     
        $this->assertEquals(0, $ret, 'error code:'.$this->_bmod->getLastErrno());
    }
    
    function test_getWhoShieldMe()
    {
        $mod = new UCModBlacklist(555555);
        $ret = $mod->addPersonToBlacklist(110000308490);
        $ret = $this->_bmod->getWhoShieldMe();
        $this->assertTrue(true, isset($ret[5555]), 'error code:'.$this->_bmod->getLastErrno());
        $ret = $mod->deletePersonOutBlacklist(110000308490);  
    }
    
                                            
    
    
    function providerUserid()
    {
        return array(
            array(33441),
        );
    }
    
}


?>